home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------
-
- dummy.c
-
- This module handles the "dummy" window. This window is a hack used
- with the Next Article and Next Thread commands to keep the subject
- window from flickering between the active and inactive states. It
- is always off-screen, and is normally hidden. The dummy window is
- also used during printing to set the print job name.
-
- Copyright © 1994-1995, Northwestern University.
-
- ----------------------------------------------------------------------------*/
-
- #include "glob.h"
- #include "dummy.h"
- #include "windutil.h"
- #include "memutil.h"
-
-
-
- static WindowPtr gDummyWindow = nil;
-
-
-
- /*----------------------------------------------------------------------------
- ShowDummyWindow
-
- Show the dummy window. Create it if it doesn't already exist.
-
- Exit: function result = window kind.
-
- The dummy window is an empty off-screen window of kind kDummy.
- It is normally hidden and not used for anything. It is temporarily
- brought to the front and shown by the Next Article and Next Thread
- commands as a hack to avoid activating the subject window during these
- operations. This avoids having the selected cell in the subject window
- flicker between the active and inactive highlighting styles, which is
- annoying.
- ----------------------------------------------------------------------------*/
-
- OSErr ShowDummyWindow (void)
- {
- Rect bounds;
- OSErr err = noErr;
- TWindow **info = nil;
-
- if (gDummyWindow == nil) {
- SetRect(&bounds, -0x7010, -0x7010, -0x7000, -0x7000);
- err = MyNewWindow(&bounds, "\p", false, documentProc, (WindowPtr)-1,
- false, 0, &gDummyWindow);
- if (err != noErr) goto exit;
- err = MyNewHandle(sizeof(TWindow), &info);
- if (err != noErr) goto exit;
- (**info).kind = kDummy;
- SetWRefCon(gDummyWindow, (long)info);
- }
- ShowWindow(gDummyWindow);
- SelectWindow(gDummyWindow);
- return noErr;
-
- exit:
-
- MyDisposeWindow(gDummyWindow);
- gDummyWindow = nil;
- MyDisposeHandle(info);
- return err;
- }
-
-
-
- /*----------------------------------------------------------------------------
- HideDummyWindow
-
- Hide the dummy window.
- ----------------------------------------------------------------------------*/
-
- void HideDummyWindow (void) {
- if (gDummyWindow != nil) HideWindow(gDummyWindow);
- }
-
-
-
- /*----------------------------------------------------------------------------
- Activate
-
- Handle an activate event for the dummy window.
-
- Entry: wind = pointer to dummy window.
- act = true to activate, false to deactivate
- ----------------------------------------------------------------------------*/
-
- static void Activate (WindowPtr wind, Boolean act)
- {
- }
-
-
-
- /*----------------------------------------------------------------------------
- Update
-
- Handle an update event for the dummy window.
-
- Entry: wind = pointer to dummy window.
- ----------------------------------------------------------------------------*/
-
- static void Update (WindowPtr wind)
- {
- }
-
-
-
- /*----------------------------------------------------------------------------
- Mouse
-
- Handle a mouse down event in the content area of the dummy window.
-
- Entry: wind = pointer to dummy window.
- where = location of mouse down in local coords.
- modifiers = modifiers field from event record.
-
- Exit: function result = error code.
- ----------------------------------------------------------------------------*/
-
- static OSErr Mouse (WindowPtr wind, Point where, short modifiers)
- {
- return noErr;
- }
-
-
-
- /*----------------------------------------------------------------------------
- Draggable
-
- Determine whether a mouse down event is on a draggable object in the
- dummy window.
-
- Entry: wind = pointer to dummy window.
- where = location of mouse down event, in local coordinates.
- modifiers = modifiers field from event record.
-
- Exit: function result = true if object is draggable.
- ----------------------------------------------------------------------------*/
-
- static Boolean Draggable (WindowPtr wind, Point where, short modifiers)
- {
- return false;
- }
-
-
-
- /*----------------------------------------------------------------------------
- Key
-
- Handle a key down event for the dummy window.
-
- Entry: wind = pointer to dummy window.
- theChar = ASCII code of key.
- theKey = keyboard code of key.
- modifiers = modifiers field from event record.
-
- Exit: function result = error code.
- ----------------------------------------------------------------------------*/
-
- static OSErr Key (WindowPtr wind, unsigned char theChar, unsigned char theKey,
- short modifiers)
- {
- return noErr;
- }
-
-
-
- /*----------------------------------------------------------------------------
- Grow
-
- Handle a mouse down event in the grow box of the dummy window.
-
- Entry: wind = pointer to dummy window.
- where = location of mouse down event, in global coordinates.
-
- Exit: function result = error code.
- ----------------------------------------------------------------------------*/
-
- static OSErr Grow (WindowPtr wind, Point where)
- {
- return noErr;
- }
-
-
-
- /*----------------------------------------------------------------------------
- Zoom
-
- Zoom the dummy window.
-
- Entry: wind = pointer to dummy window.
- zoomDir = zoom direction = inZoomIn or inZoomOut.
-
- Exit: function result = error code.
- ----------------------------------------------------------------------------*/
-
- static OSErr Zoom (WindowPtr wind, short zoomDir)
- {
- return noErr;
- }
-
-
-
- /*----------------------------------------------------------------------------
- Command
-
- Handle a command for the dummy window.
-
- Entry: wind = pointer to dummy window.
- menu = the menu.
- item = the item.
- modifiers = modifiers field from event record.
-
- Exit: function result = error code.
- ----------------------------------------------------------------------------*/
-
- static OSErr Command (WindowPtr wind, short menu, short item, short modifiers)
- {
- return noErr;
- }
-
-
-
- /*----------------------------------------------------------------------------
- Close
-
- Close the dummy window.
-
- Entry: wind = pointer to dummy window.
-
- Exit: function result = error code.
- ----------------------------------------------------------------------------*/
-
- static OSErr Close (WindowPtr wind)
- {
- return noErr;
- }
-
-
-
- /*----------------------------------------------------------------------------
- Help
-
- Handle help balloons for a dummy window.
-
- Entry: wind = pointer to dummy window.
- where = current mouse location in local coordinates.
- ----------------------------------------------------------------------------*/
-
- static void Help (WindowPtr wind, Point where)
- {
- }
-
-
-
- /*----------------------------------------------------------------------------
- Idle
-
- Handle idle time tasks for the dummy window.
-
- Entry: wind = pointer to dummy window.
-
- Exit: cursorRgn = cursor region for WaitNextEvent mouse moved events.
- ----------------------------------------------------------------------------*/
-
- static void Idle (WindowPtr wind, RgnHandle cursorRgn)
- {
- }
-
-
-
- /*----------------------------------------------------------------------------
- InitDummyDispatchTable
-
- Initialize the dispatch table for the dummy window.
- ----------------------------------------------------------------------------*/
-
- void InitDummyDispatchTable (void)
- {
- TDispatch *d;
-
- d = &gDispatch[kDummy];
-
- d->activate = Activate;
- d->update = Update;
- d->mouse = Mouse;
- d->draggable = Draggable;
- d->key = Key;
- d->grow = Grow;
- d->zoom = Zoom;
- d->command = Command;
- d->close = Close;
- d->idle = Idle;
- d->help = Help;
- }
-